<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
button{
    margin: 10px;
}
</style>
<body>
<div id="app"></div>

<script src="node_modules/@babel/standalone/babel.js"></script>
<script src="node_modules/react/umd/react.development.js"></script>
<script src="node_modules/react-dom/umd/react-dom.development.js"></script>


<script type="text/babel">

class MyComponent extends React.Component {
constructor(){
    super()
this.state={
    message:'Hello Word , this is component !'
}
}

  render() {
    return (
        <div>
        <h1>{this.state.message}</h1> 
        <button onClick={console.log(this)}>点击</button>
       <button onClick={this.handClick.bind(this,123,'abc')}>点击</button>
       {/** 下面的方式可以自定义事件e的位置 下面中用到了两个function **/}
        <button onClick={(e)=>this.handClick(123,e,45)}>点击</button>
      </div>
    )
  }
//事件都以hand开头好
handClick(a,b,e){
    // return this.state.message="草你妈逼"  此方法不可行
    this.setState({message:"草你妈逼"})  /**事件参数在最后不能修改,**/
    console.log(a,b,e);
    
}

}

const element =< MyComponent/>   

ReactDOM.render(element,document.getElementById("app"))  

</script>
    
</body>
</html>